#ifndef __OLED_H__
#define __OLED_H__

#include "string.h"
#include "stm32f10x_rcc.h"
#include "stm32f10x_gpio.h"
#include "delay.h"

#define I2C_OLED_GPIO_PORT    GPIOB
#define I2C_OLED_GPIO_CLK     RCC_APB2Periph_GPIOB
#define I2C_OLED_SCL_PIN      GPIO_Pin_10
#define I2C_OLED_SDA_PIN      GPIO_Pin_11

/*引脚配置*/
#define OLED_W_SCL(x)		GPIO_WriteBit(GPIOB, GPIO_Pin_10, (BitAction)(x))
#define OLED_W_SDA(x)		GPIO_WriteBit(GPIOB, GPIO_Pin_11, (BitAction)(x))

#define I2C_HIGH ((uint32_t)1)
#define I2C_LOW  (uint32_t)0

void OLED_I2C_Display_Init(void);
void OLED_SetCursor(uint8_t Y, uint8_t X);
void OLED_Clear(void);
void OLED_ShowChar(uint8_t Line, uint8_t Column, char Char);
void OLED_ShowString(uint8_t Line, uint8_t Column, char *String);
uint32_t OLED_Pow(uint32_t X, uint32_t Y);
void OLED_ShowNum(uint8_t Line, uint8_t Column, uint32_t Number, uint8_t Length);
void OLED_ShowSignedNum(uint8_t Line, uint8_t Column, int32_t Number, uint8_t Length);
void OLED_ShowHexNum(uint8_t Line, uint8_t Column, uint32_t Number, uint8_t Length);
void OLED_ShowBinNum(uint8_t Line, uint8_t Column, uint32_t Number, uint8_t Length);

/**
 * 
 * 
 */
void OLED_Refresh(void);
void OLED_SetPixel(uint8_t x, uint8_t y, OLED_ColorMode color);
void OLED_DrawLine(uint8_t x1, uint8_t y1, uint8_t x2, uint8_t y2, OLED_ColorMode color);
void OLED_DrawRectangle(uint8_t x, uint8_t y, uint8_t w, uint8_t h, OLED_ColorMode color);
void OLED_DrawFilledRectangle(uint8_t x, uint8_t y, uint8_t w, uint8_t h, OLED_ColorMode color);
void OLED_DrawTriangle(uint8_t x1, uint8_t y1, uint8_t x2, uint8_t y2, uint8_t x3, uint8_t y3, OLED_ColorMode color);
void OLED_DrawFilledTriangle(uint8_t x1, uint8_t y1, uint8_t x2, uint8_t y2, uint8_t x3, uint8_t y3, OLED_ColorMode color);
void OLED_DrawCircle(uint8_t x0, uint8_t y0, uint8_t r, OLED_ColorMode color);
void OLED_DrawFilledCircle(uint8_t x0, uint8_t y0, uint8_t r, OLED_ColorMode color);
void OLED_DrawEllipse(uint8_t x0, uint8_t y0, uint8_t a, uint8_t b, OLED_ColorMode color);


#endif // __OLED_H__